package cn.sczhyt.modules.app.controller;

import cn.sczhyt.common.utils.PageUtils;
import cn.sczhyt.common.utils.R;
import cn.sczhyt.modules.app.annotation.Login;
import cn.sczhyt.modules.app.annotation.LoginUser;
import cn.sczhyt.modules.app.entity.UserEntity;
import cn.sczhyt.modules.szhy.entity.MeetingFileUserEntity;
import cn.sczhyt.modules.szhy.service.MeetingFileUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


/**
 * 参会人员会议的附件表
 *
 * @author luojialin
 * @email 78357966@qq.com
 * @date 2021-03-29 10:07:28
 */
@Api("APP用户与文件")
@RestController
@RequestMapping("app/meetingfileuser")
public class AppMeetingFileUserController {
    @Autowired
    private MeetingFileUserService meetingFileUserService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("szhy:meetingfileuser:list")
    public R list(@RequestParam Map<String, Object> params){

        PageUtils page = meetingFileUserService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
		MeetingFileUserEntity meetingFileUser = meetingFileUserService.getById(id);

        return R.ok().put("meetingFileUser", meetingFileUser);
    }


    /**
     * 保存
     */
    @ApiOperation("阅读文件")
    @Login
    @PostMapping("/read/{fileId}")
    public R save(@LoginUser UserEntity user,@PathVariable("fileId") String fileId){

        meetingFileUserService.read(user,fileId);

        return R.ok();
    }


//
//    /**
//     * 修改
//     */
//    @RequestMapping("/update")
//    @RequiresPermissions("szhy:meetingfileuser:update")
//    public R update(@RequestBody MeetingFileUserEntity meetingFileUser){
//		meetingFileUserService.updateById(meetingFileUser);
//
//        return R.ok();
//    }
//
//    /**
//     * 删除
//     */
//    @RequestMapping("/delete")
//    @RequiresPermissions("szhy:meetingfileuser:delete")
//    public R delete(@RequestBody String[] ids){
//		meetingFileUserService.removeByIds(Arrays.asList(ids));
//
//        return R.ok();
//    }

}
